package com.by.config;

import org.springframework.amqp.core.AbstractExchange;
import org.springframework.amqp.core.ExchangeTypes;


import java.util.HashMap;
import java.util.Map;

/**
 * 自定义延迟交换器
 */
public class LazyExchange extends AbstractExchange {


    static Map<String, Object> map = new HashMap<>();

    static {
        //指定对应的rabbitmq内置交换器类型
        map.put("x-delayed-type","direct");
    }


    @Override
    public String getType() {
        return "x-delayed-message"; // 插件交换器类型
    }

    public LazyExchange(String name) {
        super(name,true,false,map);

    }

}
